/**
 * 作者：SlaneYang https://juejin.im/post/5a091afe6fb9a044ff30f402
 * @desc 获取浏览器类型和版本
 * @return {String} 
 */
function getExplore() {
	var sys = {},
		ua = navigator.userAgent.toLowerCase(),
		s;
	(s = ua.match(/rv:([\d.]+)\) like gecko/)) ? sys.ie = s[1]:
	(s = ua.match(/msie ([\d\.]+)/)) ? sys.ie = s[1] :
	(s = ua.match(/edge\/([\d\.]+)/)) ? sys.edge = s[1] :
	(s = ua.match(/firefox\/([\d\.]+)/)) ? sys.firefox = s[1] :
	(s = ua.match(/(?:opera|opr).([\d\.]+)/)) ? sys.opera = s[1] :
	(s = ua.match(/chrome\/([\d\.]+)/)) ? sys.chrome = s[1] :
	(s = ua.match(/version\/([\d\.]+).*safari/)) ? sys.safari = s[1] : 0;
	// 根据关系进行判断
	if (sys.ie) return ('IE: ' + sys.ie)
	if (sys.edge) return ('EDGE: ' + sys.edge)
	if (sys.firefox) return ('Firefox: ' + sys.firefox)
	if (sys.chrome) return ('Chrome: ' + sys.chrome)
	if (sys.opera) return ('Opera: ' + sys.opera)
	if (sys.safari) return ('Safari: ' + sys.safari)
	return 'Unkonwn'
}


/**
 * 作者：SlaneYang https://juejin.im/post/5a091afe6fb9a044ff30f402
 * @desc 获取操作系统类型
 * @return {String} 
 */
function getOS() {
    var userAgent = 'navigator' in window && 'userAgent' in navigator && navigator.userAgent.toLowerCase() || '';
    var vendor = 'navigator' in window && 'vendor' in navigator && navigator.vendor.toLowerCase() || '';
    var appVersion = 'navigator' in window && 'appVersion' in navigator && navigator.appVersion.toLowerCase() || '';

    if (/mac/i.test(appVersion)) return 'MacOSX'
    if (/win/i.test(appVersion)) return 'windows'
    if (/linux/i.test(appVersion)) return 'linux'
    if (/iphone/i.test(userAgent) || /ipad/i.test(userAgent) || /ipod/i.test(userAgent)) 'ios'
    if (/android/i.test(userAgent)) return 'android'
    if (/win/i.test(appVersion) && /phone/i.test(userAgent)) return 'windowsPhone'
}


/**
 * 作者：SlaneYang https://juejin.im/post/5a091afe6fb9a044ff30f402
 * @desc   判断是否为手机号
 * @param  {String|Number} str 
 * @return {Boolean} 
 */
function isPhoneNum(str) {
    return /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/.test(str)
}